<template>
    <div>
        <van-nav-bar title="搜索" left-text="返回" left-arrow @click-left="() => { { $router.back('/') } }" />
        <van-search v-model="ss" shape="round" background="#4fc08d" placeholder="请输入搜索关键词" />
        <van-cell-group v-for="item in qsdata">
    <router-link :to="`/detail/${item.goods_id}`">
        <van-cell  :title="item.goods_name"  />
    </router-link>
        </van-cell-group>

    </div>
</template>

<script setup>
import { ref, watch } from 'vue'
import { qsearchApi } from '@/api/api';
let ss = ref('')
let qsdata = ref([])
watch(ss, (val) => {
    qsearchApi(val).then(res => {
        console.log('搜索数据', res);
        qsdata.value = res.data.message
    })
})
</script>

<style lang="scss" scoped></style>